<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>参数配置</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CSS__/oksub.css">
    <script type="text/javascript" src="__LIB__/loading/okLoading.js"></script>
</head>
<body>
<div class="ok-body">
    <div class="layui-card">
        <div class="layui-tab layui-tab-card" lay-filter="configTab">
            <ul class="layui-tab-title">
                <li lay-id="base" class="layui-this">基础参数</li>
                <li lay-id="website">网站设置</li>
                <li lay-id="mail">邮件服务</li>
                <li lay-id="sms">短信服务</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form ibms-tab-form" width100 lay-filter="website">
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">默认密码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="default_password" placeholder="请输入默认密码" autocomplete="off" value="{$config.default_password}" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <div class="layui-input-block">
                                    <button type="submit" class="layui-btn" lay-submit lay-filter="save">立即保存</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form ibms-tab-form" width100 lay-filter="website">
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">网站名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_name" placeholder="请输入网站名称" autocomplete="off" value="{$config.site_name}" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">网站标题</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_title" placeholder="请输入网站标题" autocomplete="off" value="{$config.site_title}" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">META关键字</label>
                                <div class="layui-input-block">
                                    <textarea name="site_description" placeholder="请输入网站关键字，用英文逗号隔开" class="layui-textarea">{$config.site_keywords}</textarea>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">META描述</label>
                                <div class="layui-input-block">
                                    <textarea name="site_description" placeholder="请输入网站描述" class="layui-textarea">{$config.site_description}</textarea>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">版权信息</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_copyright" placeholder="请输入版权信息" autocomplete="off" value="{$config.site_copyright}" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <label class="layui-form-label">ICP备案信息</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_icp" placeholder="请输入备案信息" autocomplete="off" value="{$config.site_icp}" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-col-lg7">
                                <div class="layui-input-block">
                                    <button type="submit" class="layui-btn" lay-submit lay-filter="save">立即保存</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form ibms-tab-form" width100 lay-filter="mail">
                        <div class="layui-form-item">
                            <label class="layui-form-label">SMTP服务器</label>
                            <div class="layui-input-inline">
                                <input type="text" name="smtp_server" placeholder="请输入SMTP服务器" autocomplete="off" value="{$config.smtp_server|default=''}" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">如：smtp.163.com</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">SMTP端口号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="smtp_port" placeholder="请输入SMTP端口号" autocomplete="off" value="{$config.smtp_port|default=''}" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">一般为 25 或 465</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">发件人姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="from_username" placeholder="请输入发件人姓名" autocomplete="off" value="{$config.from_username|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">发件人邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" name="from_email" placeholder="请输入发件人邮箱" autocomplete="off" value="{$config.from_email|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱登入密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="from_password" placeholder="请输入邮箱登入密码" autocomplete="off" value="{$config.from_password|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit lay-filter="save">立即保存</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form ibms-tab-form" width100 lay-filter="mail">
                        <div class="layui-form-item">
                            <label class="layui-form-label">KeyID</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_accesskey_id" placeholder="请输入AccessKeyID" autocomplete="off" value="{$config.sms_accesskey_id|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">KeySecret</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_accesskey_secret" placeholder="请输入AccessKeySecret" autocomplete="off" value="{$config.sms_accesskey_secret|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">签名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_signname" placeholder="请输入签名" autocomplete="off" value="{$config.sms_signname|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">模板CODE</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sms_tplcode" placeholder="请输入模板CODE" autocomplete="off" value="{$config.sms_tplcode|default=''}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit lay-filter="save">立即保存</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__LIB__/layui/layui.js"></script>
<script>
    layui.use(["element", "form", "jquery", "okLayer", "okUtils"], function () {
        let element = layui.element;
        let form = layui.form;
        let $ = layui.jquery;
        let okLayer = layui.okLayer;
        let okUtils = layui.okUtils;
        okLoading.close();

        // tab定位
        let tabIndex = location.hash.replace(/^#tab=/, '');
        element.tabChange('configTab', tabIndex);
        element.on('tab(configTab)', function (elem) {
            location.hash = 'tab='+ $(this).attr('lay-id');
        });

        form.on("submit(save)", function (data) {
            okUtils.ajax("{:url('save')}", "post", data.field, true).done(function (response) {
                okLayer.greenTickMsg(response.msg, function () {
                    location.reload();
                });
            }).fail(function (error) {
                //console.log(error)
            });
            return false;
        });
    });
</script>
</body>
</html>
